Nigedo
|
Diviner
|
|
|
Reged: 05/30/03
|
Posts: 2586
|
Loc: Deep beneath Vvardenfell
|
|
|
I have been testing this Global function/variable and researching info about it here on this forum.
Many people have said that it was broken by Bloodmoon, yet it is an essential part of the "Karrod_movement" script within Tribunal's MQ, so was it fixed by a post Bloodmoon patch, does anyone know?
Or, is it still broken?
Can anyone tell me how they think it is broken?
I appear to have unreliable results from testing it, myself. I have found that
Set myVariable1 to DaysPassed
works, and will continue to update the value of myVariable1 (Global or local) each day, until or unless I add a second statement
Set myVariable2 to DaysPassed
In which case, neither will update from then on.
Admittedly, this happened when I set the value of myVariable2 through the console and this does not indicate that the same would be true if I scripted it instead. I will test this some more, but I just wanted to learn what others think about the condition of this important function.
-------------------- Dean of The Theoretical Whirling School Of Vivec
The Whirling School | Academy for Dwemer Studies | TES Lore FAQ
Post Extras:
|
andoreth
|
Disciple
|
|
|
Reged: 05/29/03
|
Posts: 1002
|
Loc: Wandering around in the CS
|
|
|
I use dayspassed in several of my mods (advanced herbalism and potted plants) and have seen no issues with it not working properly, with or without Bloodmoon.
I have also read about the reports of "broken-ness", but no one ever says what is broken about it.
-------------------- Making Morrowind a little more cluttered every day!
Advanced Herbalism
Potted Plants
Real Furniture
My ugly websight
mirror
Post Extras:
|
Nigedo
|
Diviner
|
|
|
Reged: 05/30/03
|
Posts: 2586
|
Loc: Deep beneath Vvardenfell
|
|
|
Could you post an example script where you've used it, so I can see it working correctly in context?
BTW, comments about it being broken have mainly come from JOG and one or two other gurus, see:-
this thread
and this thread.
-------------------- Dean of The Theoretical Whirling School Of Vivec
The Whirling School | Academy for Dwemer Studies | TES Lore FAQ
Post Extras:
|
andoreth
|
Disciple
|
|
|
Reged: 05/29/03
|
Posts: 1002
|
Loc: Wandering around in the CS
|
|
|
Well, unfortunately I am in the middle of building my current mod in the CS, and cannot shut it down to open Advanced Herbalism.
But, here is an outline of the relevant part of the script:
Begin plantscript
short daypicked
if ( OnActivate == 1 )
disable
set daypicked to ( Dayspassed + 29 )
a bunch of other stuff here
endif
if ( daypicked < Dayspassed )
enable
else
return
endif
so, when the plant is picked, the variable daypicked is set to 29 more than the current dayspassed. Then, when daypicked is again less than dayspassed (30 days latter), the plant is enabled and ready to be picked again.
In the almanac, I use the check (again, paraphrased):
if ( today != Dayspassed )
set today to Dayspassed
set jjsAlmanac to ( Random, # )
endif
-------------------- Making Morrowind a little more cluttered every day!
Advanced Herbalism
Potted Plants
Real Furniture
My ugly websight
mirror
Post Extras:
|
Nigedo
|
Diviner
|
|
|
Reged: 05/30/03
|
Posts: 2586
|
Loc: Deep beneath Vvardenfell
|
|
|
Fair enough, that seems a straightforward and expected application of DaysPassed.
So, have you any idea why it wouldn't be working here?
Code:
Begin olaf_script_strongchest
; Note "MineDays" is a Global short variable
Short payments; number of weekly payments owing
If ( MenuMode )
Return
Endif
If ( MineDays > 0 ); set to value of "DaysPassed" from dialogue results
If ( ( DaysPassed - MineDays ) >= 7 )
Set MineDays to MineDays + 7
Set payments to payments + 1
If ( ( DaysPassed - MineDays ) < 7 )
While ( payments > 0 )
Set payments to payments - 1
AddItem "gold_001", 500
EndWhile
Endif
Endif
Endif
End
-------------------- Dean of The Theoretical Whirling School Of Vivec
The Whirling School | Academy for Dwemer Studies | TES Lore FAQ
Post Extras:
|
andoreth
|
Disciple
|
|
|
Reged: 05/29/03
|
Posts: 1002
|
Loc: Wandering around in the CS
|
|
|
My only guess is that global variables don't like to inter-act with other global variables in that way.
Try this:
Begin olaf_script_strongchest
; Note "MineDays" is a Global short variable
Short payments; number of weekly payments owing
If ( MenuMode )
Return
Endif
If ( MineDays > 0 ); set to value of "DaysPassed" from dialogue results
If ( Minedays <= ( Dayspassed - 7 ) )
Set MineDays to MineDays + 7
Set payments to payments + 1
If ( DaysPassed < ( Minedays + 7 ) )
While ( payments > 0 )
Set payments to payments - 1
AddItem "gold_001", 500
EndWhile
Endif
Endif
Endif
End
-------------------- Making Morrowind a little more cluttered every day!
Advanced Herbalism
Potted Plants
Real Furniture
My ugly websight
mirror
Edited by andoreth (05/09/04 05:50 AM)
Post Extras:
|
andoreth
|
Disciple
|
|
|
Reged: 05/29/03
|
Posts: 1002
|
Loc: Wandering around in the CS
|
|
|
I only changed the first global check line, I'll edit the second now.
There, I think that is right, though you'll want to check the math.
-------------------- Making Morrowind a little more cluttered every day!
Advanced Herbalism
Potted Plants
Real Furniture
My ugly websight
mirror
Edited by andoreth (05/09/04 05:51 AM)
Post Extras:
|
Nigedo
|
Diviner
|
|
|
Reged: 05/30/03
|
Posts: 2586
|
Loc: Deep beneath Vvardenfell
|
|
|
Quote:
My only guess is that global variables don't like to inter-act with other global variables in that way.
Hmm... I guess that could be. I'll test it out and see, thanks.
-------------------- Dean of The Theoretical Whirling School Of Vivec
The Whirling School | Academy for Dwemer Studies | TES Lore FAQ
Post Extras:
|
ManaUser
|
Master
|
|
|
Reged: 06/01/00
|
Posts: 6089
|
Loc: Long Beach, CA, USA
|
|
|
Maybe I'm just over cautious, but I like to avoid complex lines like this:
If ( ( DaysPassed - MineDays ) >= 7 )
I'd usually do something liek this instead:
short Temp set Temp to ( DaysPassed - MineDays ) If ( Temp >= 7 )
Or combined with andoreth's idea:
short Temp set Temp to ( Dayspassed - 7 ) If ( Minedays <= Temp )
Post Extras:
|
Nigedo
|
Diviner
|
|
|
Reged: 05/30/03
|
Posts: 2586
|
Loc: Deep beneath Vvardenfell
|
|
|
I can see the wisdom in taking that approach. I didn't feel that those lines were particularly complex though.
In any case, there is still the issue that in a simpler test script, a local variable stopped being updated with the current value of DaysPassed when a second variable in the same script was set to the value of DaysPassed through the console.
I am at a complete loss to know why this would happen. I can only guess that using the console to call the value of DaysPassed to attribute it to a variable in a script, where another function is calling the same value, causes some kind of hiccup (technically speaking ).
However, if I can get DaysPassed to work reliably in a script alone, I will be quite happy regardless of the constraints.
-------------------- Dean of The Theoretical Whirling School Of Vivec
The Whirling School | Academy for Dwemer Studies | TES Lore FAQ
Post Extras:
|
ManaUser
|
Master
|
|
|
Reged: 06/01/00
|
Posts: 6089
|
Loc: Long Beach, CA, USA
|
|
|
Could you post that test script? I can't seem to duplicate that error. Was it somethign like this? Code:
begin DaysPassedTestScr
short Var1 short Var2
set Var1 to DaysPassed if ( OnActivate ) MessageBox "Var1=%g Var2=%g DaysPassed=%g", Var1, Var2, DaysPassed endif
end Then "set Var2 to DaysPassed" int he console.
It seemed to work fine. Or did your test script still involve comparing the two? Maybe that's where it goofs up.
Post Extras:
|
Nigedo
|
Diviner
|
|
|
Reged: 05/30/03
|
Posts: 2586
|
Loc: Deep beneath Vvardenfell
|
|
|
Yes, it was something like that, I didn't keep it I'm sorry (bit untidy of me ). But I set two variables to DaysPassed through the console at different stages and the script involved a test of whether one of them, a Global, had been initialized.
Anyway, I've tested the issue with Globals further and isolated the problem, I believe.
This script will NOT work:-
Code:
; MineDays is a Global short variable
If ( MineDays > 0 ); initialized from dialogue
If ( ( MineDays + 7 ) <= DaysPassed )
MessageBox "One week has passed!"
Endif
Endif
Whereas this script WILL work:-
Code:
Short days
; MineDays is a Global short variable
Set days to MineDays
If ( days > 0 ); initialized from dialogue
If ( ( days + 7 ) <= DaysPassed )
MessageBox "One week has passed!"
Endif
Endif
So the problem is with testing the value of DaysPassed against the value of a Global variable.
I do not know whether this is also the case for Global functions/variables other than DaysPassed, such as GameHour, Day etc.
-------------------- Dean of The Theoretical Whirling School Of Vivec
The Whirling School | Academy for Dwemer Studies | TES Lore FAQ
Post Extras:
|
ManaUser
|
Master
|
|
|
Reged: 06/01/00
|
Posts: 6089
|
Loc: Long Beach, CA, USA
|
|
|
Huh, well, good to know.
Post Extras:
|